Skip to content

Fix dof and background motion vectors on webgpu#23629

Merged
alice-i-cecile merged 5 commits intobevyengine:mainfrom
beicause:webgpu-dof-and-background-motion-vectors
Apr 28, 2026
Merged

Fix dof and background motion vectors on webgpu#23629
alice-i-cecile merged 5 commits intobevyengine:mainfrom
beicause:webgpu-dof-and-background-motion-vectors

Conversation

@beicause
Copy link
Copy Markdown
Member

@beicause beicause commented Apr 3, 2026

Objective

WebGPU-only fix extracted from #22554 and #22555. Fixes #20459

Solution

Fix normal + motion vector prepass by setting write mask to empty. This is a firefox/wgpu bug that it's not validated gfx-rs/wgpu#9147, but chromium does.

Fix dof with bokeh mode. I guess it's naga_oil bug but I'm not sure.

Testing

I tested dof and skybox examples on web.

@beicause beicause force-pushed the webgpu-dof-and-background-motion-vectors branch from 3defd77 to 1d747f3 Compare April 3, 2026 01:27
@alice-i-cecile alice-i-cecile added C-Bug An unexpected or incorrect behavior A-Rendering Drawing game state to the screen O-WebGPU Specific to the WebGPU render API S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Apr 3, 2026
@github-project-automation github-project-automation Bot moved this to Needs SME Triage in Rendering Apr 3, 2026
@alice-i-cecile alice-i-cecile added X-Uncontroversial This work is generally agreed upon D-Straightforward Simple bug fixes and API improvements, docs, test and examples labels Apr 26, 2026
Copy link
Copy Markdown
Contributor

@eswartz eswartz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I ran the two mentioned examples using bevy run --example {skybox,depth_of_field} -Fwebgpu,free_camera web under Google Chrome Version 147.0.7727.116 (Official Build) (64-bit) on Linux/X11 with the webgpu options enabled.

They work!

Comment thread crates/bevy_core_pipeline/src/prepass/background_motion_vectors.rs Outdated
Comment thread crates/bevy_post_process/src/dof/mod.rs
@alice-i-cecile alice-i-cecile added S-Waiting-on-Author The author needs to make changes or address concerns before this can be merged and removed S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Apr 26, 2026
Copy link
Copy Markdown
Contributor

@eswartz eswartz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Eep, this consistently generates

@ 127.0.0.1:4000/build/skybox.js:3678
 ERROR crates/bevy_render/src/error_handler.rs:114 Caught rendering error: Color target has no corresponding fragment stage output but writeMask (ColorWriteMask::(Red|Green|Blue|Alpha)) is not zero. - While validating targets[0] framebuffer output. - While validating fragment state. - While calling [Device].CreateRenderPipeline([RenderPipelineDescriptor ""background_motion_vectors_pipeline""]).
127.0.0.1:4000/:1 Color target has no corresponding fragment stage output but writeMask (ColorWriteMask::(Red|Green|Blue|Alpha)) is not zero.
 - While validating targets[0] framebuffer output.
 - While validating fragment state.
 - While calling [Device].CreateRenderPipeline([RenderPipelineDescriptor ""background_motion_vectors_pipeline""]).

via bevy run --example skybox -Fwebgpu,free_camera web

(depth_of_field does work though)

Copy link
Copy Markdown
Contributor

@eswartz eswartz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All better now :)

@alice-i-cecile alice-i-cecile added S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it and removed S-Waiting-on-Author The author needs to make changes or address concerns before this can be merged labels Apr 27, 2026
@alice-i-cecile alice-i-cecile added this pull request to the merge queue Apr 28, 2026
Merged via the queue into bevyengine:main with commit 160e26d Apr 28, 2026
40 checks passed
@github-project-automation github-project-automation Bot moved this from Needs SME Triage to Done in Rendering Apr 28, 2026
@beicause beicause deleted the webgpu-dof-and-background-motion-vectors branch April 28, 2026 06:30
tychedelia pushed a commit to processing/bevy that referenced this pull request Apr 30, 2026
# Objective

WebGPU-only fix extracted from bevyengine#22554 and bevyengine#22555. Fixes bevyengine#20459

## Solution

Fix normal + motion vector prepass by setting write mask to empty. This
is a firefox/wgpu bug that it's not validated
gfx-rs/wgpu#9147, but chromium does.

Fix dof with bokeh mode. I guess it's `naga_oil` bug but I'm not sure.

## Testing

I tested dof and skybox examples on web.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Rendering Drawing game state to the screen C-Bug An unexpected or incorrect behavior D-Straightforward Simple bug fixes and API improvements, docs, test and examples O-WebGPU Specific to the WebGPU render API S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it X-Uncontroversial This work is generally agreed upon

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

The combination of Skybox + MotionVectorPrepass + NormalPrepass is broken on WebGPU

3 participants